home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EuroCD 3
/
EuroCD 3.iso
/
Graphics_Utils
/
Video Easel
/
CAMRexx
/
IsingII.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1998-06-24
|
1KB
|
38 lines
/* Microcannonical Ising Model with energy banks */
/* by an idea of Toffoli, in CAMRexx by THOR */
MakeAlgorithm:
PLANEALGORITHM neumann hvphases
return
MakePlane:
lattice=(horz=vert)
if phase=1 then lattice=~lattice
/* handle only even or odd sublattice */
if lattice then; do
bonds=north+south+east+west /* #bonds for spin down */
if center then bonds=4-bonds /* and spin up */
select
when bonds=1 & center_=1 then; do /* one bond, energy in the bank */
new=3-centers /* invert our state and the bank */
SETPLANES new
end
when bonds=2 then; do /* two bonds */
if plane=0 then; do
new=~center
SETPLANE new /* flip only spin */
end; else
SETPLANE center_ /* preserve bank */
end
when bonds=3 & center_=0 then; do /* three bonds, bank empty */
new=3-centers
SETPLANES new
end
otherwise
SETPLANES centers
end /* of select */
end; else
SETPLANES centers
return